package com.banmao.youZone.entity;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class ResultData<T> {

    private String code;

    private String message;

    private T data;

    public static <E> ResultData<E> success(E data) {
        return success(data, "");
    }

    public static <E> ResultData<E> success(E data, String message) {
        return ResultData.<E>builder()
                .data(data)
                .message(message)
                .code("200")
                .build();
    }

    public static ResultData<String> error(String message) {
        return ResultData.<String>builder()
                .message(message)
                .code("500")
                .build();
    }

}
